<!DOCTYPE html>
<html>
{include file="public/head" /}
<style>
td {
	font-size:13px;
}
</style>
<body class="zanpian-body">
<section class="content">
<div id="contents">
  <div class="callout callout-title">
    <button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
    <h4>{$nav.title}</h4>
    <p>卡密统计 （共：{$count_total} 积分 {$count_total / $GLOBALS['config']['user']['pay']['pay_scale']} Rmb  已用：{$count_use|default=0} 积分 / 未用：{$count_nouse|default=0} 积分)</p>
    </div>
  <div class="panel-body">
    <div class="panel-tool">
      <div class="row">
        <div class="col-md-5 col-sm-6 col-xs-12 pb15">
          <div id="toolbar" class="toolbar"><a href="{:url('index')}" class="btn btn-primary ajax-url"><i class="fa fa-refresh"></i> </a> 
           <a class="btn btn-success btn-add geturl " href="{:url('make')}" data-name="生成卡密"><i class="fa fa-plus"></i> 生成</a>
           <button type="reset" class="btn btn-info copy"><i class="fa fa-copy"></i> 复制</button>
           <a href="{:url('del')}" form="#list" class="confirm btn btn-danger btn-del btn-disabled ajax-post disabled"><i class="fa fa-trash"></i> 删除</a> <span id="selectedChks">已选择<strong></strong>记录</span> </div>
          <!-- /.toolbar -->
        </div>
         <div class="col-md-7 col-sm-6 col-xs-12 mb15">  
                  <div class="pull-rightt">
              <div class="pull-left search">
                <select name="status" class="form-control select2 margin10" type="ajax-select">
                  <option value="{:url('index',array('uid'=>$uid,'wd'=>$wd,'status'=>$status,'type'=>$type,'order'=>$order,'limit'=>$limit))}">卡密面值</option>
                  {volist name="score_list" id="vo"}
                  <option value="{:url('index',array('uid'=>$uid,'score'=>$vo,'wd'=>$wd,'status'=>$status,'type'=>$type,'order'=>$order,'limit'=>$limit))}" {eq name="vo" value="$score"}selected{/eq}>{$vo}积分</option>
{/volist}  
                </select>
              </div>   
                       <div class="pull-left search">
                <select name="status" class="form-control select2 margin10" type="ajax-select">
                  <option value="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'type'=>$type,'order'=>$order,'limit'=>$limit))}">使用状态</option>
                  <option value="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>1,'type'=>$type,'order'=>$order,'limit'=>$limit))}" {eq name="status" value="1"}selected{/eq}>已使用</option>
                 <option value="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>0,'type'=>$type,'order'=>$order,'limit'=>$limit))}" {eq name="status" value="0"}selected{/eq}>未使用</option> 
                </select>
              </div>                                   
                  <div class="columns-right pull-left">
                <form class="form-inline form-search nice-validator n-default" id="form-search" method="post">
                <div class="input-group">
                <!-- /btn-group -->
                <input class="form-control" placeholder="积分,卡密" type="text" name="wd">
                <div class="input-group-btn">
                  <button type="submit" class="btn btn-default ajax-post" title="普通搜索" form="#form-search"><i class="glyphicon glyphicon-search"></i></button>
                </div>                
              </div>
</form>
              </div>
              </div>                                   
      </div>
    </div>
    <!-- /.panel-tool -->
    <div class="tab-content">
      <form id="list" method="post">
        <table id="table" class="table table-striped table-bordered table-hover" style="margin-top: 0px;" width="100%">
          <thead>
            <tr>
              <th style="text-align:center;vertical-align: middle; width:5%"> <label class="pretty success">
                <input type="checkbox" id="checkall" class="delcheckall">
                <label><i class="mdi mdi-check"></i></label>
                </label>
              </th>
              <th style="text-align:center;vertical-align: middle;"> {eq name="orders" value="id desc"}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'id','order'=>'asc','limit'=>$limit))}" class="text-link sort ajax-url">编号 <i class="fa fa-angle-up"></i></a>{else/}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'id','order'=>'desc','limit'=>$limit))}" class="text-link sort ajax-url">编号 <i class="fa fa-angle-down"></i></a>{/eq}</th>
              <th style="text-align:center;vertical-align: middle;">{eq name="orders" value="score desc"}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'score','order'=>'asc','limit'=>$limit))}" class="text-link sort ajax-url">卡密面值 <i class="fa fa-angle-up"></i></a>{else/}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'score','order'=>'desc','limit'=>$limit))}" class="text-link sort ajax-url">卡密面值 <i class="fa fa-angle-down"></i></a>{/eq}</th>
              <th style="text-align:center;vertical-align: middle;">{eq name="orders" value="number desc"}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'number','order'=>'asc','limit'=>$limit))}" class="text-link sort ajax-url">充值卡密 <i class="fa fa-angle-up"></i></a>{else/}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'number','order'=>'desc','limit'=>$limit))}" class="text-link sort ajax-url">充值卡密 <i class="fa fa-angle-down"></i></a>{/eq}</th>
              <th style="text-align:center;vertical-align: middle;" class="hidden-xs">{eq name="orders" value="addtime desc"}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'addtime','order'=>'asc','limit'=>$limit))}" class="text-link sort ajax-url">生成时间 <i class="fa fa-angle-up"></i></a>{else/}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'addtime','order'=>'desc','limit'=>$limit))}" class="text-link sort ajax-url">生成时间 <i class="fa fa-angle-down"></i></a>{/eq}</th>
              <th style="text-align:center;vertical-align: middle;" class="hidden-xs">{eq name="orders" value="usetime desc"}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'usetime','order'=>'asc','limit'=>$limit))}" class="text-link sort ajax-url">使用时间 <i class="fa fa-angle-up"></i></a>{else/}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'usetime','order'=>'desc','limit'=>$limit))}" class="text-link sort ajax-url">使用时间 <i class="fa fa-angle-down"></i></a>{/eq}</th>
              <th style="text-align:center;vertical-align: middle;">{eq name="orders" value="status desc"}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'status','order'=>'asc','limit'=>$limit))}" class="text-link sort ajax-url">使用状态 <i class="fa fa-angle-up"></i></a>{else/}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'status','order'=>'desc','limit'=>$limit))}" class="text-link sort ajax-url">使用状态 <i class="fa fa-angle-down"></i></a>{/eq}</th>
              <th style="text-align:center;vertical-align: middle;" class="hidden-xs">{eq name="orders" value="uid desc"}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'uid','order'=>'asc','limit'=>$limit))}" class="text-link sort ajax-url">使用ID <i class="fa fa-angle-up"></i></a>{else/}<a href="{:url('index',array('uid'=>$uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>'uid','order'=>'desc','limit'=>$limit))}" class="text-link sort ajax-url">使用ID <i class="fa fa-angle-down"></i></a>{/eq}</th>              
              <th style="text-align:center;vertical-align: middle;">操作</th>
            </tr>
          </thead>
          <tbody>
          {notempty name="list"}
          {volist name="list" id="vo"}
          <tr>
            <td class="bs-checkbox" style="text-align:center;vertical-align:middle; font-size:14px"><label class="pretty success">
              <input type="checkbox" name="id[]" value="{$vo['card_id']}" id="checkbox">
              <label><i class="mdi mdi-check"></i></label>
              </label></td>
            <td style="text-align:center;vertical-align: middle;">{$vo['card_id']}</td>
            <td style="text-align:center;vertical-align: middle;"><a href="{:url('index',array('uid'=>$vo.card_uid,'score'=>$vo['card_score'],'wd'=>$wd,'status'=>$status,'type'=>$type,'order'=>$order,'limit'=>$limit))}" class="text-link ajax-url">{$vo['card_score']}积分</a></td>
            <td style="text-align:center;vertical-align: middle;"><span class="copy_number">{$vo['card_number']}</span></td>
            <td style="text-align:center;vertical-align: middle;" class="hidden-xs">{$vo.card_addtime|date='Y-m-d H:i:s',###}</td>
            <td style="text-align:center;vertical-align: middle;" class="hidden-xs">{eq name="vo.card_usetime" value="0"}未用{else /}{$vo.card_usetime|date='Y-m-d H:i:s',###}{/eq}</td>
            <td style="text-align:center;vertical-align: middle;">{eq name="vo.card_status" value="1"}已使用{else/}未使用{/eq}</td>
            <td style="text-align:center;vertical-align: middle;" class="hidden-xs"><a href="{:url('index',array('uid'=>$vo.card_uid,'score'=>$score,'wd'=>$wd,'status'=>$status,'type'=>$type,'order'=>$order,'limit'=>$limit))}" class="text-link ajax-url" >{$vo.card_uid}</a></td>
            <td style="text-align:center;vertical-align: middle;">
             <a href="{:url('del',array('id'=>$vo['card_id']))}" class="confirm btn btn-danger btn-xs confirm ajax-post"><i class="fa fa-trash-o"></i> 删除</a></td>
          </tr>
          {/volist}
          {else/}
          <tr>
            <td style="text-align:center;vertical-align: middle;" colspan="15" >抱歉，没有找到相关内容！</td>
          </tr>
          {/notempty}
          </tbody>
          
        </table>
      </form>
    </div>
    {gt name="list->lastPage()" value="1"}
    <div class="panel-page">
      <div class="pull-left panel-page-info hidden-xs"><span class="pagination-info">共{$list->total()}条 {$list->currentPage()}/{$list->lastPage()} </span><span class="page-list">每页显示 {$list->listRows()} 条</span></div>
      <div class="panel-page-url ajax-page">
        <ul class="pagination">
          {$list->render()}
          <div class="panel-page-select pull-left">
            <select class="select2 ajax-select" data-url="{:url_page(request()->action(),request()->param(),1)}">
              <option value="10" {eq name="limit" value="10"}selected{/eq}>
              10 条/页
              </option>
              <option value="20" {eq name="limit" value="20"}selected{/eq}>
              20 条/页
              </option>
              <option value="30" {eq name="limit" value="30"}selected{/eq}>
              30 条/页
              </option>
              <option value="40" {eq name="limit" value="40"}selected{/eq}>
              40 条/页
              </option>
              <option value="50" {eq name="limit" value="50"}selected{/eq}>
              50 条/页
              </option>
              <option value="99" {eq name="limit" value="99"}selected{/eq}>
              99 条/页
              </option>
            </select>
          </div>
          <div class="panel-page-jump">
            <input type="input" name="page" id="page" min="1" value="{$list->currentPage()}" class="form-control"/>
            <input type="button" value="跳 转" data-url="{:url_page(request()->action(),request()->param())}" class="btn btn-default ajax-jump" />
          </div>
        </ul>
      </div>
    </div>
    <!-- /.panel-page -->
    {/gt} </div>
  <!-- /.panel-body -->
  </div>
</section>
{include file="public/footer" /}
<script type="text/javascript">
$(document).ready(function() {
	zanpian.cms.all();
	$(document).on("click", ".geturl", function(e) {
		zanpian.api.popurl($(this).attr('href'), $(this).data("name"));
		return false;
	});
	$(document).on('click', ".copy", function() {
		$html = new Array();
		$(".copy_number").each(function() {
			$html.push($(this).html());
		});
		layer.open({
			type: 1,
			anim: 2,
			title: '卡密列表:请手动选择 CTRL+C复制',
			area: ['auto', 'auto'],
			skin: 'layui-layer-rim',
			//加上边框
			content: '<div style="padding:15px;font-size:14px;line-height:24px">' + $html.join('<br/>') + '</div>'
		});
	})
});
</script>
</body>
</html>
